<template>
	<view>
	    <view v-for="item in datalist" class="itemnva" @click="get_detail_one(item.id)" >
	        <view class="items">订单号：{{item.order_no}}</view>
	        <view class="items">网点编号：{{item.uid}}</view>
	        <view class="items">网点名称：{{item.uname}}</view>
	        <view class="items flex" v-if="item.status == 0">申请状态：<span class="bbb">待审核</span></view>
	        <view class="items flex" v-if="item.status == 1">申请状态：<span class="succ">审核通过</span></view>
	        <view class="items flex" v-if="item.status == 2">申请状态：<span class="red">已拒绝</span></view>
	        <view class="items">退货数量：{{item.xn}} 罐</view>
	        <view class="items">申请时间：{{item.add_time}}</view>
			<view class="shenpi" v-if="item.status == 0">
				<view class="yy jbd" @click="jujued(item)" >拒绝</view>
				<view class="yy acd" @click="acceptd(item)" >通过</view>
			</view>
	    </view>
	    <view class="nodata"  v-if="datalist.length == 0">暂无数据</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				 datalist:[]
			}
		},
		 onShow() {
			this.get_data()
		},
		methods: {
			get_data(){
			  var data={}
			  var that=this
			  data.jxs_code=uni.getStorageSync('fahuo_username').user_code
			  this.request('/api/duoqudao/get_jxs_shenpi_log', data,"post").then(ret => {
				  that.datalist=ret.data
			  })
			},
			get_detail_one(id){
				uni.navigateTo({
				  url: '/pages/main/duojifahuo/tuihuoappley/myapply?id='+id,
				})
			},
			//拒绝
			jujued(item){
				var data={}
				var log_id=item.id
				var that=this
				data.jxs_code=uni.getStorageSync('fahuo_username').user_code
				data.log_id=log_id
				data.action="no"
				this.request('/api/duoqudao/shenhe_apply', data,"post").then(ret => {
					if(ret.code){
					  uni.showToast({ title: '操作成功',icon:"none"})
					  that.get_data()
					}else{
					  uni.showToast({ title:'操作失败',icon:"none"})
					}
				})
			},
			//审核通过
			acceptd(item){
				var data={}
				var log_id=item.id
				var that=this
				data.jxs_code=uni.getStorageSync('fahuo_username').user_code
				data.log_id=log_id
				data.action="accept";
				this.request('/api/duoqudao/shenhe_apply', data,"post").then(ret => {
					if(ret.code){
					  uni.showToast({ title: '审核通过',icon:"none"})
					  that.get_data()
					}else{
					  uni.showToast({ title:'操作失败',icon:"none"})
					}
				})
			},
		}
	}
</script>

<style>
.items{
  line-height: 25px;
  font-size: 14px;
  padding-left: 15px;
}
.jbd{
	background-color: red;
	color: #fff;
}
.acd{
	background-color: #1B764A;
	color: #fff;
}
.itemnva{
  margin: 10px;
  border: 1px solid #eee;
  border-radius: 20px;
  padding: 15px 0px;
  background-color: #fff;
}
.nodata{
  text-align: center;
  color: #999;
  margin-top: 150px;
}
page{
  background-color: #f5f5f5;
}
.shenpi{
  display: flex;
  justify-content:space-between;
  width: 80%;
  margin: 0 auto;
  line-height: 36px;
}
.yy{
  width: 94px;
  text-align: center;
  border: 1px solid #eee;
  border-radius: 5px;
}
.red{
  color: red;
}
.succ{
  color: #1B764A;
}
.bbb{
  color: #565631;
}
.flex{
  display: flex;
}
</style>
